package com.student.service.impl;

import java.sql.SQLException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.student.dao.IStudentMapper;
import com.student.entity.Student;
import com.student.service.IStudentService;

@Service
public class StudentServiceImpl implements IStudentService{

	@Autowired
	private IStudentMapper iStudentMapper;
	
	@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED)
	@Override
	public int save(Student s) throws SQLException {
		return iStudentMapper.save(s);
	}
	
	@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED)
	@Override
	public int remove(Student s) throws SQLException {
		return iStudentMapper.remove(s);
	}
	
	@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED)
	@Override
	public int update(Student s) throws SQLException {
		return iStudentMapper.update(s);
	}
	
	@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.SUPPORTS)
	@Override
	public List<Student> queryAll() throws SQLException {
		return iStudentMapper.queryAll();
	}
	
	@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.SUPPORTS)
	@Override
	public Student queryById(String id) throws SQLException {
		return iStudentMapper.queryById(id);
	}
}
